﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AsyncTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            _ = Async1();
            Console.WriteLine("........按任意键退出");
            Console.ReadKey();
        }

        static async Task Async1()
        {
            Console.WriteLine("异步开始");
            var r = await Async2();
            var x = await Async3(r);
            Console.WriteLine("结果是{0}",r+x);
        }

        static async Task<int> Async2()
        {
           await Task.Delay(1000);
           return 100;
        }

        static async Task<int> Async3(int x)
        {
            await Task.Delay(1000);
            return x % 7;
        }

    }
}
